<!DOCTYPE html>
<html>
<head>
    <title>启用聊天调试模式</title>
    <style>
        body { font-family: Arial, sans-serif; padding: 20px; }
        button { padding: 10px 20px; margin: 10px; font-size: 16px; }
        .success { color: green; }
        .info { color: blue; }
    </style>
</head>
<body>
    <h1>聊天调试工具</h1>
    
    <button onclick="enableDebug()">启用调试模式</button>
    <button onclick="disableDebug()">禁用调试模式</button>
    <button onclick="refreshApp()">刷新应用</button>
    <button onclick="openApp()">打开应用</button>
    
    <div id="status"></div>
    
    <script>
        function enableDebug() {
            localStorage.setItem('CHAT_DEBUG', 'true');
            document.getElementById('status').innerHTML = '<p class="success">✅ 调试模式已启用</p>';
        }
        
        function disableDebug() {
            localStorage.removeItem('CHAT_DEBUG');
            document.getElementById('status').innerHTML = '<p class="info">ℹ️ 调试模式已禁用</p>';
        }
        
        function refreshApp() {
            if (window.opener) {
                window.opener.location.reload();
                document.getElementById('status').innerHTML = '<p class="success">🔄 应用已刷新</p>';
            } else {
                document.getElementById('status').innerHTML = '<p class="info">ℹ️ 请手动刷新应用页面</p>';
            }
        }
        
        function openApp() {
            window.open('http://localhost:5173/', '_blank');
            document.getElementById('status').innerHTML = '<p class="success">🚀 应用已在新窗口打开</p>';
        }
        
        // 显示当前状态
        window.onload = function() {
            const debugEnabled = localStorage.getItem('CHAT_DEBUG') === 'true';
            document.getElementById('status').innerHTML = 
                `<p class="info">当前调试模式: ${debugEnabled ? '启用' : '禁用'}</p>`;
        }
    </script>
</body>
</html>
